#include "../tools.h"


class Solution {
public:
    bool trace(TreeNode* node1, TreeNode* node2){
        if(node1 == nullptr && node2 == nullptr) return true;
        if(node1 == nullptr || node2 == nullptr) return false;
        if(node1->val != node2->val) return false;

        return trace(node1->left, node2->right) && trace(node1->right, node2->left);
    }
    bool isSymmetric(TreeNode* root) {
        if(root == nullptr) return true;

        return trace(root->left, root->right);
    }
};


int main(int argc, char const *argv[])
{
    Solution sol;

    vector<int> vec = {1,2,2,3,4,4,3};
    TreeNode* tree = create_tree(vec);

    cout << sol.isSymmetric(tree);


    return 0;
}
